<template>
  <div class="page">
    <div class="contact">
      <van-nav-bar title="联系人" left-text="" left-arrow :border="false" @click-left="onClickLeft">
        <template #right>
          <van-icon name="user-o" size="18" />
        </template>
      </van-nav-bar>
      <van-search v-model="value" placeholder="请输入搜索关键词" />
      <div class="menu">
        <van-cell title="新朋友" is-link />
        <van-cell title="群聊" is-link />
      </div>

      <div class="group">
        <van-collapse v-model="activeNames">
          <van-collapse-item v-for="(group,index) in groupList" :key="index"
            :title="group.title"
            :value="group.value"
            :name="group.id"
            icon="arrow"
          >
            <van-cell title="单元格" :center="true" v-for="(item,index2) in group.groupItemList" :key="index2">
              <template #title>
                <div class="group-item">
                  <van-image width="40" height="40" radius="5" :src="item.url" />
                  <div class="group-title">{{item.name}}</div>
                </div>
              </template>
            </van-cell>
          </van-collapse-item>
        </van-collapse>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      value:"",
      activeNames: [],
      groupList:[
          {
              id:1,
              title:"特别关心",
              value:"1/20",
              groupItemList:[
                  {
                      url:'https://img.yzcdn.cn/vant/cat.jpeg',
                      name:'张三'
                  },
                  {
                      url:'https://img.yzcdn.cn/vant/cat.jpeg',
                      name:'张三'
                  },
                  {
                      url:'https://img.yzcdn.cn/vant/cat.jpeg',
                      name:'张三'
                  },
                  {
                      url:'https://img.yzcdn.cn/vant/cat.jpeg',
                      name:'张三'
                  },
                  {
                      url:'https://img.yzcdn.cn/vant/cat.jpeg',
                      name:'张三'
                  }
              ]
          },
           {
              id:2,
              title:"常用群聊",
              value:"1/2",
              groupItemList:[
                  {
                      url:'https://img.yzcdn.cn/vant/cat.jpeg',
                      name:'别克君威'
                  },
                  {
                      url:'https://img.yzcdn.cn/vant/cat.jpeg',
                      name:'架构群'
                  }
              ]
          },
           {
              id:3,
              title:"我的好友",
              value:"1/20",
              groupItemList:[
                  {
                      url:'https://img.yzcdn.cn/vant/cat.jpeg',
                      name:'张三'
                  },
                  {
                      url:'https://img.yzcdn.cn/vant/cat.jpeg',
                      name:'张三'
                  },
                  {
                      url:'https://img.yzcdn.cn/vant/cat.jpeg',
                      name:'张三'
                  },
                  {
                      url:'https://img.yzcdn.cn/vant/cat.jpeg',
                      name:'张三'
                  },
                  {
                      url:'https://img.yzcdn.cn/vant/cat.jpeg',
                      name:'张三'
                  }
              ]
          }
      ]
    };
  },
  methods:{
    onClickLeft(){
        this.$router.push("/")
    }
  }
};
</script>

<style lang="less" scoped>
.contact {
  .van-nav-bar {
    /deep/ .van-icon {
      color: black !important;
    }
    /deep/ .van-nav-bar__text {
      color: black !important;
    }
  }
  .van-search {
    .van-cell {
      line-height: 30px;
    }
  }
  .menu {
    .van-cell {
      font-size: 18px;
    }
  }
  .group {
    padding-top: 20px;
    .group-item{
        display: flex;
        align-items: center;
        .group-title{
            padding-left: 10px;
            font-size: 18px;
        }
    }
  }
}
</style>
